AUX_SOURCE_DIRECTORY(src LIB_STORAGE_MANAGE_SRC)
AUX_SOURCE_DIRECTORY(src/adapter LIB_STORAGE_MANAGE_SRC)
AUX_SOURCE_DIRECTORY(src/vendor_histore LIB_STORAGE_MANAGE_SRC)
list(SORT LIB_STORAGE_MANAGE_SRC)
set(SML_BASE sml_base_open)
ADD_LIBRARY(${SML_BASE} SHARED ${LIB_STORAGE_MANAGE_SRC})

INCLUDE_DIRECTORIES(inc)
INCLUDE_DIRECTORIES(inc/vendor)
INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(../smlib)
INCLUDE_DIRECTORIES(../platform)

target_link_libraries(${SML_BASE}
    PUBLIC ${GLIB_LIBRARIES}
    PUBLIC platform_open
)

SET_TARGET_PROPERTIES(${SML_BASE} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
SET_TARGET_PROPERTIES(${SML_BASE} PROPERTIES VERSION 0.1.0 SOVERSION 0)

INSTALL(TARGETS ${SML_BASE} LIBRARY DESTINATION usr/lib64)

AUX_SOURCE_DIRECTORY(src LIB_STORAGE_MANAGE_CUSTOM_SRC)
AUX_SOURCE_DIRECTORY(src/adapter LIB_STORAGE_MANAGE_CUSTOM_SRC)
AUX_SOURCE_DIRECTORY(src/vendor_other LIB_STORAGE_MANAGE_CUSTOM_SRC)
list(SORT LIB_STORAGE_MANAGE_CUSTOM_SRC)

set(SML_CUSTOM_BASE sml_custom_base_open)
ADD_LIBRARY(${SML_CUSTOM_BASE} SHARED ${LIB_STORAGE_MANAGE_CUSTOM_SRC})

target_link_libraries(${SML_CUSTOM_BASE}
    PUBLIC ${GLIB_LIBRARIES}
    PUBLIC platform_open
)

SET_TARGET_PROPERTIES(${SML_CUSTOM_BASE} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
SET_TARGET_PROPERTIES(${SML_CUSTOM_BASE} PROPERTIES VERSION 0.1.0 SOVERSION 0)

INSTALL(TARGETS ${SML_CUSTOM_BASE} LIBRARY DESTINATION usr/lib64)